import request from "@/utils/request";

//获取menu信息 /admin/permission/menu
export function getMenu() {
  return request({
    url: "/admin/permission/menu",
  });
}
//添加 menu信息 /admin/permission/menu
export function createMenu(data) {
  return request({
    url: "/admin/permission/menu",
    method: 'post',
    data
  });
}
//获取指定 menu /admin/permission/menu
export function getEditMenu(id) {
  return request({
    url: `/admin/permission/menu/${id}`,
  });
}
//控制是否显示 admin/permission/menu
export function isShowMenu(id,type) {
  return request({
    url: `admin/permission/menu/${id}/${type}`,
  });
}
// 修改数据 /admin/permission/menu
export function changeMenu(id,data) {
  return request({
    url: `admin/permission/menu/${id}`,
    method:'PUT',
    data
  });
}
// 删除数据 /admin/permission/menu
export function delMenu(id) {
  return request({
    url: `admin/permission/menu/${id}`,
    method:'DELETE'
  });
}
export function getRole(params) {
  return request({
    url: "/admin/permission/role?",
    params,
  });
}
// 树状图 /admin/permission/menu
export function getTree() {
  return request({
    url: "/admin/permission/menu",
  });
}
// 添加角色   /admin/permission/role
export function getRoleuser(data) {
  return request({
    url: "/admin/permission/role",
    method: "POST",
    data,
  });
}
// 修改角色 /admin/permission/role/
export function getRoleuserinfo(params) {
  return request({
    url: `/admin/permission/role/${params}`,
  });
}
// 用户  /admin/permission/user
export function getUser(params) {
  return request({
    url: "/admin/permission/user",
    params,
  });
}
// 修改状态 /admin/permission/user
export function getManagement(id, status) {
  return request({
    url: `/admin/permission/user/${id}/${status}`,
  });
}
// 搜索 /admin/permission/user
export function getSearch(params) {
  return request({
    url: "/admin/permission/user/",
    params,
  });
}
// 编辑 /admin/permission/user
export function getEditor(params) {
  return request({
    url: `/admin/permission/user/${params}`,
  });
}
// 删除 /admin/permission/user/
export function getDelete(params) {
  return request({
    url: `/admin/permission/user/${params}`,
    method: "DELETE",
  });
}
// 删除 role /admin/permission/role/
export function getRoleDelete(params) {
  return request({
    url: `/admin/permission/role/${params}`,
    method: "DELETE",
  });
}
// 获取权限 /admin/permission/role
export function getPermissions() {
  return request({
    url: "/admin/permission/role",
  });
}
// 修改 http://122.51.249.55:7005/admin/permission/user/

export function getUserModify(id, data) {
  return request({
    url: `/admin/permission/user/${id}`,
    method: "PUT",
    data,
  });
}
// 添加管理员你  http://122.51.249.55:7005/admin/permission/user

export function getAddUserModify(data) {
  return request({
    url: "/admin/permission/user",
    method: "POST",
    data,
  });
}

// 上传头像 getPicture http://122.51.249.55:7005/admin/index/upload?mode=base64&type=image

export function getPicture(data) {
  return request({
    url: "/admin/index/upload?mode=base64&type=image",
    method: "POST",
    data,
  });
}
